package jdbc;

import java.io.IOException;
import java.util.Objects;
import java.util.Properties;

/**
 * @classname:PropUtil
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/27 20:31
 * @version: 0.1
 * @since:1.8
 */
public class PropUtil {
    private PropUtil(){}
    private static Properties properties;
    static {
        properties = new Properties();
        try {
            properties.load(PropUtil.class.getClassLoader().getResourceAsStream("jdbc.properties"));
            Class.forName(getValue("jdbc.driver"));
        } catch (IOException|ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static String getValue(String key){
        Objects.requireNonNull(key);
        return properties.getProperty(key," ");
    }
}
